package java_generics.why_use_generics;

import java.util.ArrayList;
import java.util.List;

public class CastElimination {

	public static void main(String[] args) {
		
		// Non generic version of String list
		List k = new ArrayList();
		k.add("hello");
		String s1 = (String) k.get(0); // requires casting
		
		// generic version of String list
		List <String>v = new ArrayList<String>();
		v.add("hello");
		String s2 = v.get(0);   // no cast

	}

}
